package generate;

import java.io.Serializable;

/**
 * @program: baseModule
 * @description:
 * @author: zhanghz001
 * @create: 2020-10-23 11:26
 **/
public class Student implements Comparable<Student>, Serializable {
    private static final long serialVersionUID = 7629345433504788924L;
    private int age;
    private String name;
    private String value;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student(int age, String name) {
        this.age = age;
        this.name = name;
    }

    public Student(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;

        return age == student.age;
    }

    @Override
    public int hashCode() {
        return age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }

    @Override
    public int compareTo(Student o) {
        System.out.println(this);
        System.out.println(o);
        System.out.println("=========");
        return this.age - o.age;
        // return 0;
    }

}
